<template>
	<view>
		<van-search :value="word" placeholder="请输入搜索关键词" @search="change" />
		<van-tag round type="primary" v-for="(item,index) in history" :key="index">
			{{item.title}}
		</van-tag>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				word:'',
				history:wx.getStorageSync('his') || []
			};
		},
		methods:{
			change(e){
				var obj = {title:e.detail}
				if(this.history.length==6){
					this.history.pop()
				}
				this.history.unshift(obj)
				wx.setStorageSync('his',this.history)
				wx.navigateTo({url:'/sub/searchlist/searchlist?word='+e.detail})
			}
			
		}
	}
</script>

<style lang="scss">

</style>
